{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from scipy.stats import stats\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\WT_mating_status\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [6.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figureS1')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['virgin_virgin']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2017-09-05T15_42_04_arena3', 'video_2017-09-07T13_28_02_arena4']\n",
      "2\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition_path in conditions:\n",
    "    condition = os.path.basename(condition_path)\n",
    "    for file in os.listdir(condition_path):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition_path, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "\n",
    "            for value in quality_df:\n",
    "                intruders.append(value + '_slice1' if condition=='virgin_added' else value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " virgin_virgin\n",
      "Copulation too short: video_2017-09-06T13_42_13_arena3\n",
      "Copulation too short: video_2017-09-26T14_52_18_arena3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'virgin_virgin': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T13_28_41_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-05T14_34_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T13_42_13_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-06T14_45_32_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-07T14_37_38_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-08T13_26_13_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T13_30_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T14_36_55_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-12T16_18_15_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-13T14_34_18_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T13_43_53_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-20T14_48_55_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T13_38_55_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-21T15_57_23_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-26T13_40_19_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T13_36_06_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T14_44_01_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-09-28T15_55_49_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-12T15_50_43_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-13T16_06_33_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-18T15_19_17_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-19T13_50_56_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T13_21_06_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-20T15_44_09_arena2',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-24T16_13_35_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-10-25T14_55_12_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T13_37_48_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T14_48_28_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-02T16_11_06_arena3',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T14_54_45_arena1',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-11-03T16_20_50_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T12_58_51_arena4',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\WT_mating_status\\\\processed\\\\virgin_virgin\\\\video_2017-12-20T14_01_01_arena3']}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "            \n",
    "            annotation_video = annotations.read(item.path.split('_slice')[0] + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError as error:\n",
    "                continue\n",
    "\n",
    "            experiments[condition].append(item.path.split('_slice')[0])\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2017-09-05T13_28_41_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2017-09-05T14_34_55_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2017-09-06T13_42_13_arena1 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2017-09-06T14_45_32_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2017-09-07T14_37_38_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2017-09-07T14_37_38_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2017-09-08T13_26_13_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2017-09-12T13_30_06_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2017-09-12T14_36_55_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-09-12T14_36_55_arena3\n",
      "Iteration: 9 \n",
      "Experiment: video_2017-09-12T16_18_15_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2017-09-13T14_34_18_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2017-09-20T13_43_53_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-09-20T13_43_53_arena3\n",
      "Iteration: 12 \n",
      "Experiment: video_2017-09-20T14_48_55_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2017-09-21T13_38_55_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2017-09-21T15_57_23_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2017-09-26T13_40_19_arena1 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2017-09-28T13_36_06_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-09-28T13_36_06_arena4\n",
      "Iteration: 17 \n",
      "Experiment: video_2017-09-28T14_44_01_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2017-09-28T15_55_49_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-09-28T15_55_49_arena3\n",
      "Iteration: 19 \n",
      "Experiment: video_2017-10-12T15_50_43_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-10-12T15_50_43_arena2\n",
      "Iteration: 20 \n",
      "Experiment: video_2017-10-13T16_06_33_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-10-13T16_06_33_arena2\n",
      "Iteration: 21 \n",
      "Experiment: video_2017-10-18T15_19_17_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2017-10-19T13_50_56_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-10-19T13_50_56_arena2\n",
      "Iteration: 23 \n",
      "Experiment: video_2017-10-20T13_21_06_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2017-10-20T15_44_09_arena2 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2017-10-24T16_13_35_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2017-10-25T14_55_12_arena1 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2017-11-02T13_37_48_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2017-11-02T14_48_28_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2017-11-02T16_11_06_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2017-11-03T14_54_45_arena1 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "No aggression for experiment video_2017-11-03T14_54_45_arena1\n",
      "Iteration: 31 \n",
      "Experiment: video_2017-11-03T16_20_50_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2017-12-20T12_58_51_arena4 \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2017-12-20T14_01_01_arena3 \n",
      "Condition: virgin_virgin \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>latency</th>\n",
       "      <th>latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>31444.0</td>\n",
       "      <td>8.734444</td>\n",
       "      <td>180</td>\n",
       "      <td>1</td>\n",
       "      <td>0.004277</td>\n",
       "      <td>0.085545</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>853.0</td>\n",
       "      <td>0.236944</td>\n",
       "      <td>617</td>\n",
       "      <td>10</td>\n",
       "      <td>0.011225</td>\n",
       "      <td>0.654950</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>11456.0</td>\n",
       "      <td>3.182222</td>\n",
       "      <td>343</td>\n",
       "      <td>6</td>\n",
       "      <td>0.009081</td>\n",
       "      <td>0.571867</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>3703.0</td>\n",
       "      <td>1.028611</td>\n",
       "      <td>950</td>\n",
       "      <td>13</td>\n",
       "      <td>0.018440</td>\n",
       "      <td>0.908403</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>12260.0</td>\n",
       "      <td>3.405556</td>\n",
       "      <td>579</td>\n",
       "      <td>7</td>\n",
       "      <td>0.012334</td>\n",
       "      <td>0.536798</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>7429.0</td>\n",
       "      <td>2.063611</td>\n",
       "      <td>53</td>\n",
       "      <td>5</td>\n",
       "      <td>0.001017</td>\n",
       "      <td>0.345403</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>8016.0</td>\n",
       "      <td>2.226667</td>\n",
       "      <td>684</td>\n",
       "      <td>12</td>\n",
       "      <td>0.013323</td>\n",
       "      <td>0.841433</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-08T13_26_13_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>18037.0</td>\n",
       "      <td>5.010278</td>\n",
       "      <td>734</td>\n",
       "      <td>5</td>\n",
       "      <td>0.014170</td>\n",
       "      <td>0.347490</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T13_30_06_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T14_36_55_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>7848.0</td>\n",
       "      <td>2.180000</td>\n",
       "      <td>94</td>\n",
       "      <td>3</td>\n",
       "      <td>0.001893</td>\n",
       "      <td>0.217461</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T16_18_15_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>8802.0</td>\n",
       "      <td>2.445000</td>\n",
       "      <td>478</td>\n",
       "      <td>4</td>\n",
       "      <td>0.008266</td>\n",
       "      <td>0.249023</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-13T14_34_18_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T13_43_53_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>21432.0</td>\n",
       "      <td>5.953333</td>\n",
       "      <td>29</td>\n",
       "      <td>2</td>\n",
       "      <td>0.000928</td>\n",
       "      <td>0.230496</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T14_48_55_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>11140.0</td>\n",
       "      <td>3.094444</td>\n",
       "      <td>248</td>\n",
       "      <td>3</td>\n",
       "      <td>0.003984</td>\n",
       "      <td>0.173516</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T13_38_55_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>7358.0</td>\n",
       "      <td>2.043889</td>\n",
       "      <td>998</td>\n",
       "      <td>19</td>\n",
       "      <td>0.020252</td>\n",
       "      <td>1.388015</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T15_57_23_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>24055.0</td>\n",
       "      <td>6.681944</td>\n",
       "      <td>80</td>\n",
       "      <td>3</td>\n",
       "      <td>0.001516</td>\n",
       "      <td>0.204693</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-26T13_40_19_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T13_36_06_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>6061.0</td>\n",
       "      <td>1.683611</td>\n",
       "      <td>328</td>\n",
       "      <td>3</td>\n",
       "      <td>0.006668</td>\n",
       "      <td>0.219557</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T14_44_01_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T15_55_49_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-12T15_50_43_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-13T16_06_33_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>46715.0</td>\n",
       "      <td>12.976389</td>\n",
       "      <td>313</td>\n",
       "      <td>3</td>\n",
       "      <td>0.005885</td>\n",
       "      <td>0.203065</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-18T15_19_17_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-19T13_50_56_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>True</td>\n",
       "      <td>8565.0</td>\n",
       "      <td>2.379167</td>\n",
       "      <td>199</td>\n",
       "      <td>6</td>\n",
       "      <td>0.003502</td>\n",
       "      <td>0.380134</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T13_21_06_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>22481.0</td>\n",
       "      <td>6.244722</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000093</td>\n",
       "      <td>0.067064</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T15_44_09_arena2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>10145.0</td>\n",
       "      <td>2.818056</td>\n",
       "      <td>127</td>\n",
       "      <td>2</td>\n",
       "      <td>0.002336</td>\n",
       "      <td>0.132448</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-24T16_13_35_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>18406.0</td>\n",
       "      <td>5.112778</td>\n",
       "      <td>511</td>\n",
       "      <td>9</td>\n",
       "      <td>0.009165</td>\n",
       "      <td>0.581103</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-25T14_55_12_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>True</td>\n",
       "      <td>22757.0</td>\n",
       "      <td>6.321389</td>\n",
       "      <td>504</td>\n",
       "      <td>8</td>\n",
       "      <td>0.009492</td>\n",
       "      <td>0.542424</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T13_37_48_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>17448.0</td>\n",
       "      <td>4.846667</td>\n",
       "      <td>338</td>\n",
       "      <td>2</td>\n",
       "      <td>0.006726</td>\n",
       "      <td>0.143281</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T14_48_28_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>True</td>\n",
       "      <td>32337.0</td>\n",
       "      <td>8.982500</td>\n",
       "      <td>122</td>\n",
       "      <td>1</td>\n",
       "      <td>0.002682</td>\n",
       "      <td>0.079138</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>55427.0</td>\n",
       "      <td>15.396389</td>\n",
       "      <td>71</td>\n",
       "      <td>1</td>\n",
       "      <td>0.001172</td>\n",
       "      <td>0.059423</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>True</td>\n",
       "      <td>14378.0</td>\n",
       "      <td>3.993889</td>\n",
       "      <td>171</td>\n",
       "      <td>2</td>\n",
       "      <td>0.004402</td>\n",
       "      <td>0.185328</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>True</td>\n",
       "      <td>10803.0</td>\n",
       "      <td>3.000833</td>\n",
       "      <td>151</td>\n",
       "      <td>3</td>\n",
       "      <td>0.004024</td>\n",
       "      <td>0.287777</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  latency  latency_mins  nframes  nbouts  ratio_frames  \\\n",
       "0             True  31444.0      8.734444      180       1      0.004277   \n",
       "1             True    853.0      0.236944      617      10      0.011225   \n",
       "2             True  11456.0      3.182222      343       6      0.009081   \n",
       "3             True   3703.0      1.028611      950      13      0.018440   \n",
       "4             True  12260.0      3.405556      579       7      0.012334   \n",
       "5             True   7429.0      2.063611       53       5      0.001017   \n",
       "6             True   8016.0      2.226667      684      12      0.013323   \n",
       "7             True  18037.0      5.010278      734       5      0.014170   \n",
       "8            False      NaN      0.000000        0       0      0.000000   \n",
       "9             True   7848.0      2.180000       94       3      0.001893   \n",
       "10            True   8802.0      2.445000      478       4      0.008266   \n",
       "11           False      NaN      0.000000        0       0      0.000000   \n",
       "12            True  21432.0      5.953333       29       2      0.000928   \n",
       "13            True  11140.0      3.094444      248       3      0.003984   \n",
       "14            True   7358.0      2.043889      998      19      0.020252   \n",
       "15            True  24055.0      6.681944       80       3      0.001516   \n",
       "16           False      NaN      0.000000        0       0      0.000000   \n",
       "17            True   6061.0      1.683611      328       3      0.006668   \n",
       "18           False      NaN      0.000000        0       0      0.000000   \n",
       "19           False      NaN      0.000000        0       0      0.000000   \n",
       "20           False      NaN      0.000000        0       0      0.000000   \n",
       "21            True  46715.0     12.976389      313       3      0.005885   \n",
       "22           False      NaN      0.000000        0       0      0.000000   \n",
       "23            True   8565.0      2.379167      199       6      0.003502   \n",
       "24            True  22481.0      6.244722        5       1      0.000093   \n",
       "25            True  10145.0      2.818056      127       2      0.002336   \n",
       "26            True  18406.0      5.112778      511       9      0.009165   \n",
       "27            True  22757.0      6.321389      504       8      0.009492   \n",
       "28            True  17448.0      4.846667      338       2      0.006726   \n",
       "29            True  32337.0      8.982500      122       1      0.002682   \n",
       "30           False      NaN      0.000000        0       0      0.000000   \n",
       "31            True  55427.0     15.396389       71       1      0.001172   \n",
       "32            True  14378.0      3.993889      171       2      0.004402   \n",
       "33            True  10803.0      3.000833      151       3      0.004024   \n",
       "\n",
       "    ratio_bouts      condition                        experiment  \n",
       "0      0.085545  virgin_virgin  video_2017-09-05T13_28_41_arena4  \n",
       "1      0.654950  virgin_virgin  video_2017-09-05T14_34_55_arena2  \n",
       "2      0.571867  virgin_virgin  video_2017-09-06T13_42_13_arena1  \n",
       "3      0.908403  virgin_virgin  video_2017-09-06T14_45_32_arena3  \n",
       "4      0.536798  virgin_virgin  video_2017-09-07T14_37_38_arena3  \n",
       "5      0.345403  virgin_virgin  video_2017-09-07T14_37_38_arena4  \n",
       "6      0.841433  virgin_virgin  video_2017-09-08T13_26_13_arena3  \n",
       "7      0.347490  virgin_virgin  video_2017-09-12T13_30_06_arena4  \n",
       "8      0.000000  virgin_virgin  video_2017-09-12T14_36_55_arena3  \n",
       "9      0.217461  virgin_virgin  video_2017-09-12T16_18_15_arena4  \n",
       "10     0.249023  virgin_virgin  video_2017-09-13T14_34_18_arena2  \n",
       "11     0.000000  virgin_virgin  video_2017-09-20T13_43_53_arena3  \n",
       "12     0.230496  virgin_virgin  video_2017-09-20T14_48_55_arena2  \n",
       "13     0.173516  virgin_virgin  video_2017-09-21T13_38_55_arena4  \n",
       "14     1.388015  virgin_virgin  video_2017-09-21T15_57_23_arena2  \n",
       "15     0.204693  virgin_virgin  video_2017-09-26T13_40_19_arena1  \n",
       "16     0.000000  virgin_virgin  video_2017-09-28T13_36_06_arena4  \n",
       "17     0.219557  virgin_virgin  video_2017-09-28T14_44_01_arena3  \n",
       "18     0.000000  virgin_virgin  video_2017-09-28T15_55_49_arena3  \n",
       "19     0.000000  virgin_virgin  video_2017-10-12T15_50_43_arena2  \n",
       "20     0.000000  virgin_virgin  video_2017-10-13T16_06_33_arena2  \n",
       "21     0.203065  virgin_virgin  video_2017-10-18T15_19_17_arena3  \n",
       "22     0.000000  virgin_virgin  video_2017-10-19T13_50_56_arena2  \n",
       "23     0.380134  virgin_virgin  video_2017-10-20T13_21_06_arena2  \n",
       "24     0.067064  virgin_virgin  video_2017-10-20T15_44_09_arena2  \n",
       "25     0.132448  virgin_virgin  video_2017-10-24T16_13_35_arena4  \n",
       "26     0.581103  virgin_virgin  video_2017-10-25T14_55_12_arena1  \n",
       "27     0.542424  virgin_virgin  video_2017-11-02T13_37_48_arena3  \n",
       "28     0.143281  virgin_virgin  video_2017-11-02T14_48_28_arena4  \n",
       "29     0.079138  virgin_virgin  video_2017-11-02T16_11_06_arena3  \n",
       "30     0.000000  virgin_virgin  video_2017-11-03T14_54_45_arena1  \n",
       "31     0.059423  virgin_virgin  video_2017-11-03T16_20_50_arena4  \n",
       "32     0.185328  virgin_virgin  video_2017-12-20T12_58_51_arena4  \n",
       "33     0.287777  virgin_virgin  video_2017-12-20T14_01_01_arena3  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Read .csv annotation files.\n",
    "        annotation_video = annotations.read(experiment_path + '.csv')\n",
    "        copulation = annotation_video[0].events[0]\n",
    "        aggression_events = annotation_video[1].events\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "\n",
    "            latency =  aggression_events[0].time - copulation.time\n",
    "            latency_mins = latency / (60 * FPS)\n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / copulation.duration\n",
    "            ratio_bouts = n_events / (copulation.duration / (60 * FPS))\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'latency': latency,\n",
    "                                            'latency_mins': latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            print('No aggression for experiment', experiment)\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'latency': np.nan,\n",
    "                                            'latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>n_aggression</th>\n",
       "      <th>n_experiments</th>\n",
       "      <th>aggression_rate</th>\n",
       "      <th>condition</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>26</td>\n",
       "      <td>34</td>\n",
       "      <td>0.764706</td>\n",
       "      <td>virgin_virgin</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   n_aggression  n_experiments  aggression_rate      condition\n",
       "0            26             34         0.764706  virgin_virgin"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Re-arrange original aggression DataFrame to get aggression rate.\n",
    "aggression_rate_df = pd.DataFrame()\n",
    "has_aggression_list = []\n",
    "for condition in condition_order:\n",
    "    \n",
    "    aggression_column = aggression_df[aggression_df['condition']==condition]\n",
    "    n_exp = aggression_column.shape[0]\n",
    "    \n",
    "    has_aggression = aggression_column[aggression_column['has_aggression']==True]\n",
    "    n_aggression = has_aggression.shape[0]\n",
    "    has_aggression_list.append(n_aggression)\n",
    "    aggression_rate = n_aggression / n_exp\n",
    "    rate_data = pd.DataFrame({'n_aggression': n_aggression,\n",
    "                              'n_experiments': n_exp,\n",
    "                              'aggression_rate': aggression_rate,\n",
    "                              'condition': condition,\n",
    "                             }, index=[0])\n",
    "        \n",
    "    aggression_rate_df = pd.concat([aggression_rate_df, rate_data], ignore_index=True)\n",
    "\n",
    "aggression_rate_df = aggression_rate_df[['n_aggression', 'n_experiments', 'aggression_rate', 'condition']]\n",
    "aggression_rate_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Occurrence"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>has_aggression</th>\n",
       "      <th>False</th>\n",
       "      <th>True</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>condition</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>virgin_virgin</th>\n",
       "      <td>8</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "has_aggression  False  True \n",
       "condition                   \n",
       "virgin_virgin       8     26"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Because female receptivity is a categorical variable, represented by a single value, the statistical Fisher Exact test\n",
    "# requires that the relevant data be arranged in a contingency table.\n",
    "contingency_table = pd.crosstab(aggression_df['condition'], aggression_df['has_aggression'])\n",
    "contingency_table"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIAAAAEFCAYAAAArNO8UAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAbWUlEQVR4nO3de1zM+f4H8NekMKV1W1SmKRWlm9JN2i6cZU8RyqK1llw74nHaOC6rlUl7zm7Wso/doiOL7ZQil3jQ4mFP7Dm2i02hErOabkIhRaHLfH5/+JljtozP0Heqmc/z8ZiH5vvNfN81rz7fy3y/7y+PEELAaCytri6A6VosABqOBUDDsQBoOBYADccCoOFUFgBCCBYsWICtW7cCANra2vDpp5/CysoKFhYWiI+Pl32vWCyGl5cXrK2t4erqipKSElWVqXmIChQXF5MJEyYQXV1d8vXXXxNCCImLiyO+vr6kpaWFPHjwgFhaWpKcnBxCCCEuLi4k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OHChV1dlkLd6khg3759ZV931PbVzc0NBQUFqi7rtUpKSvD06VM4ODhAV1cXgYGByMnJQVFRERwcHPD48WPcuXMHc+bMwYEDB7q6XDndagToqUpLS7F06VI8e/YMzc3NOHbsGCZPnoxr166hoKAAu3fvhrOzc7d784FuNgL0VH5+fsjNzYWjoyN69eqFmTNnIigoqKvLosI+C9BwbBWg4VgANBwLgIZjAdBwLAAajgVAw7EAaDgWAA3HAqDhWAA0HAuAhmMB0HAsABqOBUDDsQBouP8DoOr80LyGa0IAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 90x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = aggression_rate_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the barplot.\n",
    "sns.barplot(x='condition',\n",
    "            y='aggression_rate',\n",
    "            data=aggression_rate_df,\n",
    "            order=condition_order,\n",
    "            palette=['steelblue'],\n",
    "            edgecolor=INK\n",
    "           )\n",
    "\n",
    "# Change bar width.\n",
    "for bar in axis.patches:\n",
    "    current_x = bar.get_x()\n",
    "    current_width = bar.get_width()\n",
    "\n",
    "    new_width = 0.5\n",
    "    width_diff = current_width - new_width\n",
    "    x_offset = width_diff / 2\n",
    "    new_x = current_x + x_offset\n",
    "\n",
    "    bar.set_width(new_width)\n",
    "    bar.set_x(new_x)\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Experiments with Aggression (%)')\n",
    "axis.set_ylim(0, 1)\n",
    "axis.set_yticklabels((np.arange(0, 1.1, 0.2) * 100).astype(int))\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(exp) for exp in aggression_rate_df['n_experiments'].values]\n",
    "cell_text = np.array([row1])\n",
    "\n",
    "row_labels = ['n =']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_occurrence'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis - Whole Copulation vs First 5 Minutes of Copulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2017-09-05T13_28_41_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-05T13_28_41_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 30\n",
      "Number of detected aggressive bouts is: 1\n",
      "Iteration: 1 \n",
      "Experiment: video_2017-09-05T14_34_55_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-05T14_34_55_arena2\n",
      "Number of aggressive bouts is: 6\n",
      "Number of clean detected \"encounters\" is: 11\n",
      "Number of detected aggressive bouts is: 6\n",
      "Number of aggressive bouts is: 10\n",
      "Number of clean detected \"encounters\" is: 26\n",
      "Number of detected aggressive bouts is: 10\n",
      "Iteration: 2 \n",
      "Experiment: video_2017-09-05T15_42_04_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-05T15_42_04_arena3\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 9\n",
      "Number of detected aggressive bouts is: 4\n",
      "Number of aggressive bouts is: 8\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 8\n",
      "Iteration: 3 \n",
      "Experiment: video_2017-09-06T13_42_13_arena1.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-06T13_42_13_arena1\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 14\n",
      "Number of detected aggressive bouts is: 3\n",
      "Number of aggressive bouts is: 6\n",
      "Number of clean detected \"encounters\" is: 31\n",
      "Number of detected aggressive bouts is: 6\n",
      "Iteration: 4 \n",
      "Experiment: video_2017-09-06T14_45_32_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-06T14_45_32_arena3\n",
      "Number of aggressive bouts is: 11\n",
      "Number of clean detected \"encounters\" is: 10\n",
      "Number of detected aggressive bouts is: 11\n",
      "Number of aggressive bouts is: 13\n",
      "Number of clean detected \"encounters\" is: 30\n",
      "Number of detected aggressive bouts is: 12\n",
      "Iteration: 5 \n",
      "Experiment: video_2017-09-07T13_28_02_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-07T13_28_02_arena4\n",
      "Number of aggressive bouts is: 8\n",
      "Number of clean detected \"encounters\" is: 59\n",
      "Number of detected aggressive bouts is: 8\n",
      "Iteration: 6 \n",
      "Experiment: video_2017-09-07T14_37_38_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-07T14_37_38_arena3\n",
      "Number of aggressive bouts is: 7\n",
      "Number of clean detected \"encounters\" is: 3\n",
      "Number of detected aggressive bouts is: 0\n",
      "Number of aggressive bouts is: 7\n",
      "Number of clean detected \"encounters\" is: 22\n",
      "Number of detected aggressive bouts is: 7\n",
      "Iteration: 7 \n",
      "Experiment: video_2017-09-07T14_37_38_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-07T14_37_38_arena4\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 9\n",
      "Number of detected aggressive bouts is: 3\n",
      "Number of aggressive bouts is: 5\n",
      "Number of clean detected \"encounters\" is: 29\n",
      "Number of detected aggressive bouts is: 5\n",
      "Iteration: 8 \n",
      "Experiment: video_2017-09-08T13_26_13_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-08T13_26_13_arena3\n",
      "Number of aggressive bouts is: 8\n",
      "Number of clean detected \"encounters\" is: 26\n",
      "Number of detected aggressive bouts is: 8\n",
      "Number of aggressive bouts is: 12\n",
      "Number of clean detected \"encounters\" is: 56\n",
      "Number of detected aggressive bouts is: 12\n",
      "Iteration: 9 \n",
      "Experiment: video_2017-09-12T13_30_06_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-12T13_30_06_arena4\n",
      "Number of aggressive bouts is: 5\n",
      "Number of clean detected \"encounters\" is: 20\n",
      "Number of detected aggressive bouts is: 5\n",
      "Iteration: 10 \n",
      "Experiment: video_2017-09-12T14_36_55_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2017-09-12T16_18_15_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-12T16_18_15_arena4\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 9\n",
      "Number of detected aggressive bouts is: 2\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 24\n",
      "Number of detected aggressive bouts is: 3\n",
      "Iteration: 12 \n",
      "Experiment: video_2017-09-13T14_34_18_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-13T14_34_18_arena2\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 20\n",
      "Number of detected aggressive bouts is: 4\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 48\n",
      "Number of detected aggressive bouts is: 4\n",
      "Iteration: 13 \n",
      "Experiment: video_2017-09-20T13_43_53_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2017-09-20T14_48_55_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-20T14_48_55_arena2\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 25\n",
      "Number of detected aggressive bouts is: 2\n",
      "Iteration: 15 \n",
      "Experiment: video_2017-09-21T13_38_55_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-21T13_38_55_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 6\n",
      "Number of detected aggressive bouts is: 1\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 24\n",
      "Number of detected aggressive bouts is: 3\n",
      "Iteration: 16 \n",
      "Experiment: video_2017-09-21T15_57_23_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-21T15_57_23_arena2\n",
      "Number of aggressive bouts is: 12\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 11\n",
      "Number of aggressive bouts is: 19\n",
      "Number of clean detected \"encounters\" is: 42\n",
      "Number of detected aggressive bouts is: 18\n",
      "Iteration: 17 \n",
      "Experiment: video_2017-09-26T13_40_19_arena1.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-26T13_40_19_arena1\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 32\n",
      "Number of detected aggressive bouts is: 3\n",
      "Iteration: 18 \n",
      "Experiment: video_2017-09-28T13_36_06_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2017-09-28T14_44_01_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-09-28T14_44_01_arena3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 24\n",
      "Number of detected aggressive bouts is: 3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 57\n",
      "Number of detected aggressive bouts is: 3\n",
      "Iteration: 20 \n",
      "Experiment: video_2017-09-28T15_55_49_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2017-10-12T15_50_43_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2017-10-13T16_06_33_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2017-10-18T15_19_17_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-10-18T15_19_17_arena3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 40\n",
      "Number of detected aggressive bouts is: 3\n",
      "Iteration: 24 \n",
      "Experiment: video_2017-10-19T13_50_56_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2017-10-20T13_21_06_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-10-20T13_21_06_arena2\n",
      "Number of aggressive bouts is: 4\n",
      "Number of clean detected \"encounters\" is: 13\n",
      "Number of detected aggressive bouts is: 3\n",
      "Number of aggressive bouts is: 6\n",
      "Number of clean detected \"encounters\" is: 56\n",
      "Number of detected aggressive bouts is: 5\n",
      "Iteration: 26 \n",
      "Experiment: video_2017-10-20T15_44_09_arena2.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-10-20T15_44_09_arena2\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 47\n",
      "Number of detected aggressive bouts is: 1\n",
      "Iteration: 27 \n",
      "Experiment: video_2017-10-24T16_13_35_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-10-24T16_13_35_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 10\n",
      "Number of detected aggressive bouts is: 1\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 28\n",
      "Number of detected aggressive bouts is: 2\n",
      "Iteration: 28 \n",
      "Experiment: video_2017-10-25T14_55_12_arena1.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-10-25T14_55_12_arena1\n",
      "Number of aggressive bouts is: 9\n",
      "Number of clean detected \"encounters\" is: 21\n",
      "Number of detected aggressive bouts is: 9\n",
      "Iteration: 29 \n",
      "Experiment: video_2017-11-02T13_37_48_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-11-02T13_37_48_arena3\n",
      "Number of aggressive bouts is: 8\n",
      "Number of clean detected \"encounters\" is: 22\n",
      "Number of detected aggressive bouts is: 8\n",
      "Iteration: 30 \n",
      "Experiment: video_2017-11-02T14_48_28_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-11-02T14_48_28_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 1\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 32\n",
      "Number of detected aggressive bouts is: 2\n",
      "Iteration: 31 \n",
      "Experiment: video_2017-11-02T16_11_06_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-11-02T16_11_06_arena3\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 28\n",
      "Number of detected aggressive bouts is: 1\n",
      "Iteration: 32 \n",
      "Experiment: video_2017-11-03T14_54_45_arena1.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2017-11-03T16_20_50_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-11-03T16_20_50_arena4\n",
      "Number of aggressive bouts is: 1\n",
      "Number of clean detected \"encounters\" is: 62\n",
      "Number of detected aggressive bouts is: 1\n",
      "Iteration: 34 \n",
      "Experiment: video_2017-12-20T12_58_51_arena4.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-12-20T12_58_51_arena4\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 15\n",
      "Number of detected aggressive bouts is: 2\n",
      "Number of aggressive bouts is: 2\n",
      "Number of clean detected \"encounters\" is: 34\n",
      "Number of detected aggressive bouts is: 2\n",
      "Iteration: 35 \n",
      "Experiment: video_2017-12-20T14_01_01_arena3.csv \n",
      "Condition: virgin_virgin \n",
      "\n",
      "video_2017-12-20T14_01_01_arena3\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 17\n",
      "Number of detected aggressive bouts is: 2\n",
      "Number of aggressive bouts is: 3\n",
      "Number of clean detected \"encounters\" is: 37\n",
      "Number of detected aggressive bouts is: 3\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>ratio_frames_full</th>\n",
       "      <th>ratio_bouts_full</th>\n",
       "      <th>fraction_aggressive_encounters_full</th>\n",
       "      <th>ratio_frames_5mins</th>\n",
       "      <th>ratio_bouts_5mins</th>\n",
       "      <th>fraction_aggressive_encounters_5mins</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>0.004277</td>\n",
       "      <td>0.085545</td>\n",
       "      <td>0.033333</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>0.011225</td>\n",
       "      <td>0.654950</td>\n",
       "      <td>0.384615</td>\n",
       "      <td>0.020944</td>\n",
       "      <td>1.2</td>\n",
       "      <td>0.545455</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>0.027889</td>\n",
       "      <td>0.601190</td>\n",
       "      <td>0.533333</td>\n",
       "      <td>0.030000</td>\n",
       "      <td>0.8</td>\n",
       "      <td>0.444444</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>0.009081</td>\n",
       "      <td>0.571867</td>\n",
       "      <td>0.193548</td>\n",
       "      <td>0.011222</td>\n",
       "      <td>0.6</td>\n",
       "      <td>0.214286</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>0.018440</td>\n",
       "      <td>0.908403</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>0.042778</td>\n",
       "      <td>2.2</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>0.010564</td>\n",
       "      <td>0.276089</td>\n",
       "      <td>0.135593</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T13_28_02_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>0.012334</td>\n",
       "      <td>0.536798</td>\n",
       "      <td>0.318182</td>\n",
       "      <td>0.032167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>0.001017</td>\n",
       "      <td>0.345403</td>\n",
       "      <td>0.172414</td>\n",
       "      <td>0.001222</td>\n",
       "      <td>0.6</td>\n",
       "      <td>0.333333</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-07T14_37_38_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>0.013323</td>\n",
       "      <td>0.841433</td>\n",
       "      <td>0.214286</td>\n",
       "      <td>0.019889</td>\n",
       "      <td>1.6</td>\n",
       "      <td>0.307692</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-08T13_26_13_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>0.014170</td>\n",
       "      <td>0.347490</td>\n",
       "      <td>0.250000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T13_30_06_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T14_36_55_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>0.001893</td>\n",
       "      <td>0.217461</td>\n",
       "      <td>0.125000</td>\n",
       "      <td>0.001722</td>\n",
       "      <td>0.4</td>\n",
       "      <td>0.222222</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-12T16_18_15_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>0.008266</td>\n",
       "      <td>0.249023</td>\n",
       "      <td>0.083333</td>\n",
       "      <td>0.026556</td>\n",
       "      <td>0.8</td>\n",
       "      <td>0.200000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-13T14_34_18_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T13_43_53_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>0.000928</td>\n",
       "      <td>0.230496</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-20T14_48_55_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>0.003984</td>\n",
       "      <td>0.173516</td>\n",
       "      <td>0.125000</td>\n",
       "      <td>0.000556</td>\n",
       "      <td>0.2</td>\n",
       "      <td>0.166667</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T13_38_55_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>0.020252</td>\n",
       "      <td>1.388015</td>\n",
       "      <td>0.428571</td>\n",
       "      <td>0.039333</td>\n",
       "      <td>2.4</td>\n",
       "      <td>0.733333</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-21T15_57_23_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>0.001516</td>\n",
       "      <td>0.204693</td>\n",
       "      <td>0.093750</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-26T13_40_19_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T13_36_06_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>0.006668</td>\n",
       "      <td>0.219557</td>\n",
       "      <td>0.052632</td>\n",
       "      <td>0.018222</td>\n",
       "      <td>0.6</td>\n",
       "      <td>0.125000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T14_44_01_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-28T15_55_49_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-12T15_50_43_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-13T16_06_33_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>True</td>\n",
       "      <td>0.005885</td>\n",
       "      <td>0.203065</td>\n",
       "      <td>0.075000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-18T15_19_17_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-19T13_50_56_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>0.003502</td>\n",
       "      <td>0.380134</td>\n",
       "      <td>0.089286</td>\n",
       "      <td>0.008722</td>\n",
       "      <td>0.8</td>\n",
       "      <td>0.230769</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T13_21_06_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>0.000093</td>\n",
       "      <td>0.067064</td>\n",
       "      <td>0.021277</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-20T15_44_09_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>True</td>\n",
       "      <td>0.002336</td>\n",
       "      <td>0.132448</td>\n",
       "      <td>0.071429</td>\n",
       "      <td>0.004722</td>\n",
       "      <td>0.2</td>\n",
       "      <td>0.100000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-24T16_13_35_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>0.009165</td>\n",
       "      <td>0.581103</td>\n",
       "      <td>0.428571</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-10-25T14_55_12_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>True</td>\n",
       "      <td>0.009492</td>\n",
       "      <td>0.542424</td>\n",
       "      <td>0.363636</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T13_37_48_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>True</td>\n",
       "      <td>0.006726</td>\n",
       "      <td>0.143281</td>\n",
       "      <td>0.062500</td>\n",
       "      <td>0.004778</td>\n",
       "      <td>0.2</td>\n",
       "      <td>0.066667</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T14_48_28_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>0.002682</td>\n",
       "      <td>0.079138</td>\n",
       "      <td>0.035714</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>False</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>True</td>\n",
       "      <td>0.001172</td>\n",
       "      <td>0.059423</td>\n",
       "      <td>0.016129</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>True</td>\n",
       "      <td>0.004402</td>\n",
       "      <td>0.185328</td>\n",
       "      <td>0.058824</td>\n",
       "      <td>0.009500</td>\n",
       "      <td>0.4</td>\n",
       "      <td>0.133333</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>True</td>\n",
       "      <td>0.004024</td>\n",
       "      <td>0.287777</td>\n",
       "      <td>0.081081</td>\n",
       "      <td>0.008389</td>\n",
       "      <td>0.6</td>\n",
       "      <td>0.117647</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  ratio_frames_full  ratio_bouts_full  \\\n",
       "0             True           0.004277          0.085545   \n",
       "1             True           0.011225          0.654950   \n",
       "2             True           0.027889          0.601190   \n",
       "3             True           0.009081          0.571867   \n",
       "4             True           0.018440          0.908403   \n",
       "5             True           0.010564          0.276089   \n",
       "6             True           0.012334          0.536798   \n",
       "7             True           0.001017          0.345403   \n",
       "8             True           0.013323          0.841433   \n",
       "9             True           0.014170          0.347490   \n",
       "10           False           0.000000          0.000000   \n",
       "11            True           0.001893          0.217461   \n",
       "12            True           0.008266          0.249023   \n",
       "13           False           0.000000          0.000000   \n",
       "14            True           0.000928          0.230496   \n",
       "15            True           0.003984          0.173516   \n",
       "16            True           0.020252          1.388015   \n",
       "17            True           0.001516          0.204693   \n",
       "18           False           0.000000          0.000000   \n",
       "19            True           0.006668          0.219557   \n",
       "20           False           0.000000          0.000000   \n",
       "21           False           0.000000          0.000000   \n",
       "22           False           0.000000          0.000000   \n",
       "23            True           0.005885          0.203065   \n",
       "24           False           0.000000          0.000000   \n",
       "25            True           0.003502          0.380134   \n",
       "26            True           0.000093          0.067064   \n",
       "27            True           0.002336          0.132448   \n",
       "28            True           0.009165          0.581103   \n",
       "29            True           0.009492          0.542424   \n",
       "30            True           0.006726          0.143281   \n",
       "31            True           0.002682          0.079138   \n",
       "32           False           0.000000          0.000000   \n",
       "33            True           0.001172          0.059423   \n",
       "34            True           0.004402          0.185328   \n",
       "35            True           0.004024          0.287777   \n",
       "\n",
       "    fraction_aggressive_encounters_full  ratio_frames_5mins  \\\n",
       "0                              0.033333            0.000000   \n",
       "1                              0.384615            0.020944   \n",
       "2                              0.533333            0.030000   \n",
       "3                              0.193548            0.011222   \n",
       "4                              0.400000            0.042778   \n",
       "5                              0.135593            0.000000   \n",
       "6                              0.318182            0.032167   \n",
       "7                              0.172414            0.001222   \n",
       "8                              0.214286            0.019889   \n",
       "9                              0.250000            0.000000   \n",
       "10                             0.000000            0.000000   \n",
       "11                             0.125000            0.001722   \n",
       "12                             0.083333            0.026556   \n",
       "13                             0.000000            0.000000   \n",
       "14                             0.080000            0.000000   \n",
       "15                             0.125000            0.000556   \n",
       "16                             0.428571            0.039333   \n",
       "17                             0.093750            0.000000   \n",
       "18                             0.000000            0.000000   \n",
       "19                             0.052632            0.018222   \n",
       "20                             0.000000            0.000000   \n",
       "21                             0.000000            0.000000   \n",
       "22                             0.000000            0.000000   \n",
       "23                             0.075000            0.000000   \n",
       "24                             0.000000            0.000000   \n",
       "25                             0.089286            0.008722   \n",
       "26                             0.021277            0.000000   \n",
       "27                             0.071429            0.004722   \n",
       "28                             0.428571            0.000000   \n",
       "29                             0.363636            0.000000   \n",
       "30                             0.062500            0.004778   \n",
       "31                             0.035714            0.000000   \n",
       "32                             0.000000            0.000000   \n",
       "33                             0.016129            0.000000   \n",
       "34                             0.058824            0.009500   \n",
       "35                             0.081081            0.008389   \n",
       "\n",
       "    ratio_bouts_5mins  fraction_aggressive_encounters_5mins      condition  \\\n",
       "0                 0.0                              0.000000  virgin_virgin   \n",
       "1                 1.2                              0.545455  virgin_virgin   \n",
       "2                 0.8                              0.444444  virgin_virgin   \n",
       "3                 0.6                              0.214286  virgin_virgin   \n",
       "4                 2.2                              1.000000  virgin_virgin   \n",
       "5                 0.0                              0.000000  virgin_virgin   \n",
       "6                 1.4                              0.000000  virgin_virgin   \n",
       "7                 0.6                              0.333333  virgin_virgin   \n",
       "8                 1.6                              0.307692  virgin_virgin   \n",
       "9                 0.0                              0.000000  virgin_virgin   \n",
       "10                0.0                              0.000000  virgin_virgin   \n",
       "11                0.4                              0.222222  virgin_virgin   \n",
       "12                0.8                              0.200000  virgin_virgin   \n",
       "13                0.0                              0.000000  virgin_virgin   \n",
       "14                0.0                              0.000000  virgin_virgin   \n",
       "15                0.2                              0.166667  virgin_virgin   \n",
       "16                2.4                              0.733333  virgin_virgin   \n",
       "17                0.0                              0.000000  virgin_virgin   \n",
       "18                0.0                              0.000000  virgin_virgin   \n",
       "19                0.6                              0.125000  virgin_virgin   \n",
       "20                0.0                              0.000000  virgin_virgin   \n",
       "21                0.0                              0.000000  virgin_virgin   \n",
       "22                0.0                              0.000000  virgin_virgin   \n",
       "23                0.0                              0.000000  virgin_virgin   \n",
       "24                0.0                              0.000000  virgin_virgin   \n",
       "25                0.8                              0.230769  virgin_virgin   \n",
       "26                0.0                              0.000000  virgin_virgin   \n",
       "27                0.2                              0.100000  virgin_virgin   \n",
       "28                0.0                              0.000000  virgin_virgin   \n",
       "29                0.0                              0.000000  virgin_virgin   \n",
       "30                0.2                              0.066667  virgin_virgin   \n",
       "31                0.0                              0.000000  virgin_virgin   \n",
       "32                0.0                              0.000000  virgin_virgin   \n",
       "33                0.0                              0.000000  virgin_virgin   \n",
       "34                0.4                              0.133333  virgin_virgin   \n",
       "35                0.6                              0.117647  virgin_virgin   \n",
       "\n",
       "                              experiment  \n",
       "0   video_2017-09-05T13_28_41_arena4.csv  \n",
       "1   video_2017-09-05T14_34_55_arena2.csv  \n",
       "2   video_2017-09-05T15_42_04_arena3.csv  \n",
       "3   video_2017-09-06T13_42_13_arena1.csv  \n",
       "4   video_2017-09-06T14_45_32_arena3.csv  \n",
       "5   video_2017-09-07T13_28_02_arena4.csv  \n",
       "6   video_2017-09-07T14_37_38_arena3.csv  \n",
       "7   video_2017-09-07T14_37_38_arena4.csv  \n",
       "8   video_2017-09-08T13_26_13_arena3.csv  \n",
       "9   video_2017-09-12T13_30_06_arena4.csv  \n",
       "10  video_2017-09-12T14_36_55_arena3.csv  \n",
       "11  video_2017-09-12T16_18_15_arena4.csv  \n",
       "12  video_2017-09-13T14_34_18_arena2.csv  \n",
       "13  video_2017-09-20T13_43_53_arena3.csv  \n",
       "14  video_2017-09-20T14_48_55_arena2.csv  \n",
       "15  video_2017-09-21T13_38_55_arena4.csv  \n",
       "16  video_2017-09-21T15_57_23_arena2.csv  \n",
       "17  video_2017-09-26T13_40_19_arena1.csv  \n",
       "18  video_2017-09-28T13_36_06_arena4.csv  \n",
       "19  video_2017-09-28T14_44_01_arena3.csv  \n",
       "20  video_2017-09-28T15_55_49_arena3.csv  \n",
       "21  video_2017-10-12T15_50_43_arena2.csv  \n",
       "22  video_2017-10-13T16_06_33_arena2.csv  \n",
       "23  video_2017-10-18T15_19_17_arena3.csv  \n",
       "24  video_2017-10-19T13_50_56_arena2.csv  \n",
       "25  video_2017-10-20T13_21_06_arena2.csv  \n",
       "26  video_2017-10-20T15_44_09_arena2.csv  \n",
       "27  video_2017-10-24T16_13_35_arena4.csv  \n",
       "28  video_2017-10-25T14_55_12_arena1.csv  \n",
       "29  video_2017-11-02T13_37_48_arena3.csv  \n",
       "30  video_2017-11-02T14_48_28_arena4.csv  \n",
       "31  video_2017-11-02T16_11_06_arena3.csv  \n",
       "32  video_2017-11-03T14_54_45_arena1.csv  \n",
       "33  video_2017-11-03T16_20_50_arena4.csv  \n",
       "34  video_2017-12-20T12_58_51_arena4.csv  \n",
       "35  video_2017-12-20T14_01_01_arena3.csv  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Exclude experiments without copulation (since aggression is only observed during copulation).\n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        try:\n",
    "            copulation = annotation_video[0].events[0]\n",
    "        except IndexError:\n",
    "            continue\n",
    "\n",
    "        aggression_events_full = annotation_video[1].events\n",
    "        n_events_full = len(aggression_events_full)\n",
    "        \n",
    "        aggression_events_5mins = list(filter(lambda event: event.time < (copulation.time + 18000), annotation_video[1].events)) # Consider aggression only during the first 5 minutes of copulation.\n",
    "        n_events_5mins = len(aggression_events_5mins)\n",
    "\n",
    "        if n_events_full > 0:\n",
    "            \n",
    "            ratio_frames_full = sum([aggression.duration for aggression in aggression_events_full]) / copulation.duration\n",
    "            ratio_bouts_full = n_events_full / (copulation.duration / (60 * FPS))\n",
    "            \n",
    "            ratio_frames_5mins = sum([aggression.duration for aggression in aggression_events_5mins]) / (5 * 60 * FPS)\n",
    "            ratio_bouts_5mins = n_events_5mins / 5\n",
    "\n",
    "            # Fetch tracking data.\n",
    "            aggression_track, _, copulation_interval, aggression_timepoints = helpers.process_track_data(experiment_path[:-4],\n",
    "                                                                                                         trackfeat_columns=['dist_to_other'],\n",
    "                                                                                                         is_control=True,\n",
    "                                                                                                         fly_id=2,\n",
    "                                                                                                         include_aggression_only=False\n",
    "                                                                                                        )\n",
    "\n",
    "            # Keep only frames within copulation time.\n",
    "            sliced_aggression_full = aggression_track.loc[copulation_interval[0]:copulation_interval[1]]\n",
    "            aggression_timepoints_full = [event for event in aggression_timepoints]\n",
    "            sliced_aggression_5mins = aggression_track.loc[copulation_interval[0]:copulation_interval[0]+(5*60*FPS)]\n",
    "            aggression_timepoints_5mins = [event for event in aggression_timepoints if event[0] < copulation_interval[0]+(5*60*FPS)]\n",
    "\n",
    "            # Apply threshold(s).\n",
    "            proximity = sliced_aggression_5mins['dist_to_other'].values < 4\n",
    "\n",
    "            # Detect event start and end, and package them into a list of tuples.\n",
    "            if proximity[0] == True:\n",
    "                proximity = np.insert(proximity, 0, False)\n",
    "            proximity_onset = proximity[:-1] < proximity[1:]\n",
    "            proximity_offset = proximity[:-1] > proximity[1:]\n",
    "            onset_indices = np.where(proximity_onset==True)[0] + copulation_interval[0]\n",
    "            offset_indices = np.where(proximity_offset==True)[0] + copulation_interval[0]\n",
    "\n",
    "            raw_events = list(zip(onset_indices, offset_indices))\n",
    "            if len(raw_events) > 0:\n",
    "\n",
    "                if len(raw_events) == 1:\n",
    "                    clean_events = raw_events\n",
    "                else:\n",
    "                    # Combine events that are very close to each other into a single event.\n",
    "                    clean_events = helpers.stitch_events(raw_events, suppress=True)\n",
    "\n",
    "                assert len(clean_events) <= len(raw_events), 'Stitched events list is bigger than original list: {} vs {}'.format(len(clean_events), len(raw_events))\n",
    "\n",
    "                # Get accuracy for our detector.\n",
    "                if len(aggression_timepoints_5mins) > 0:\n",
    "                    nd_aggression, _, _, _ = helpers.calc_detection_accuracy(aggression_timepoints_5mins,\n",
    "                                                                             clean_events,\n",
    "                                                                             threshold=0.25,\n",
    "                                                                             use_thresh=True\n",
    "                                                                            )\n",
    "\n",
    "            # In case a given experiment has no proximity encounters whatsoever.\n",
    "            else:\n",
    "                nd_aggression = 0\n",
    "                print('No encounters for this experiment\\n')\n",
    "\n",
    "            # From the extracted data, calculate all the variables we need.\n",
    "            fraction_aggressive_encounters_5mins = nd_aggression / len(clean_events) if len(aggression_timepoints_5mins) > 0 else 0\n",
    "            fraction_aggressive_encounters_5mins = fraction_aggressive_encounters_5mins if fraction_aggressive_encounters_5mins <= 1 else 1\n",
    "\n",
    "            # Apply threshold(s).\n",
    "            proximity = sliced_aggression_full['dist_to_other'].values < 4\n",
    "\n",
    "            # Detect event start and end, and package them into a list of tuples.\n",
    "            if proximity[0] == True:\n",
    "                proximity = np.insert(proximity, 0, False)\n",
    "            proximity_onset = proximity[:-1] < proximity[1:]\n",
    "            proximity_offset = proximity[:-1] > proximity[1:]\n",
    "            onset_indices = np.where(proximity_onset==True)[0] + copulation_interval[0]\n",
    "            offset_indices = np.where(proximity_offset==True)[0] + copulation_interval[0]\n",
    "\n",
    "            raw_events = list(zip(onset_indices, offset_indices))\n",
    "            if len(raw_events) > 0:\n",
    "\n",
    "                if len(raw_events) == 1:\n",
    "                    clean_events = raw_events\n",
    "                else:\n",
    "                    # Combine events that are very close to each other into a single event.\n",
    "                    clean_events = helpers.stitch_events(raw_events, suppress=True)\n",
    "\n",
    "                assert len(clean_events) <= len(raw_events), 'Stitched events list is bigger than original list: {} vs {}'.format(len(clean_events), len(raw_events))\n",
    "\n",
    "                # Get accuracy for our detector.\n",
    "                if len(aggression_timepoints_full) > 0:\n",
    "                    nd_aggression, _, _, _ = helpers.calc_detection_accuracy(aggression_timepoints_full,\n",
    "                                                                             clean_events,\n",
    "                                                                             threshold=0.25,\n",
    "                                                                             use_thresh=True\n",
    "                                                                            )\n",
    "\n",
    "            # In case a given experiment has no proximity encounters whatsoever.\n",
    "            else:\n",
    "                nd_aggression = 0\n",
    "                print('No encounters for this experiment\\n')\n",
    "                \n",
    "            # From the extracted data, calculate all the variables we need.\n",
    "            fraction_aggressive_encounters_full = nd_aggression / len(clean_events) if len(aggression_timepoints_full) > 0 else 0\n",
    "            fraction_aggressive_encounters_full = fraction_aggressive_encounters_full if fraction_aggressive_encounters_full <= 1 else 1\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'ratio_frames_full': ratio_frames_full,\n",
    "                                            'ratio_bouts_full': ratio_bouts_full,\n",
    "                                            'fraction_aggressive_encounters_full': fraction_aggressive_encounters_full,\n",
    "                                            'ratio_frames_5mins': ratio_frames_5mins,\n",
    "                                            'ratio_bouts_5mins': ratio_bouts_5mins,\n",
    "                                            'fraction_aggressive_encounters_5mins': fraction_aggressive_encounters_5mins,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'ratio_frames_full': 0, \n",
    "                                            'ratio_bouts_full': 0,\n",
    "                                            'fraction_aggressive_encounters_full': 0,\n",
    "                                            'ratio_frames_5mins': 0, \n",
    "                                            'ratio_bouts_5mins': 0,\n",
    "                                            'fraction_aggressive_encounters_5mins': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>annotation_time_frames</th>\n",
       "      <th>annotation_time_bouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>annotation_time_encounters</th>\n",
       "      <th>fraction_aggressive_encounters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_full</td>\n",
       "      <td>ratio_bouts_full</td>\n",
       "      <td>0.004277</td>\n",
       "      <td>0.085545</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "      <td>fraction_aggressive_encounters_full</td>\n",
       "      <td>0.033333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_full</td>\n",
       "      <td>ratio_bouts_full</td>\n",
       "      <td>0.011225</td>\n",
       "      <td>0.654950</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "      <td>fraction_aggressive_encounters_full</td>\n",
       "      <td>0.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_full</td>\n",
       "      <td>ratio_bouts_full</td>\n",
       "      <td>0.027889</td>\n",
       "      <td>0.601190</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "      <td>fraction_aggressive_encounters_full</td>\n",
       "      <td>0.533333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_full</td>\n",
       "      <td>ratio_bouts_full</td>\n",
       "      <td>0.009081</td>\n",
       "      <td>0.571867</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "      <td>fraction_aggressive_encounters_full</td>\n",
       "      <td>0.193548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_full</td>\n",
       "      <td>ratio_bouts_full</td>\n",
       "      <td>0.018440</td>\n",
       "      <td>0.908403</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "      <td>fraction_aggressive_encounters_full</td>\n",
       "      <td>0.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>283</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_5mins</td>\n",
       "      <td>ratio_bouts_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3.csv</td>\n",
       "      <td>fraction_aggressive_encounters_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>284</th>\n",
       "      <td>False</td>\n",
       "      <td>ratio_frames_5mins</td>\n",
       "      <td>ratio_bouts_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1.csv</td>\n",
       "      <td>fraction_aggressive_encounters_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>285</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_5mins</td>\n",
       "      <td>ratio_bouts_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4.csv</td>\n",
       "      <td>fraction_aggressive_encounters_5mins</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>286</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_5mins</td>\n",
       "      <td>ratio_bouts_5mins</td>\n",
       "      <td>0.009500</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4.csv</td>\n",
       "      <td>fraction_aggressive_encounters_5mins</td>\n",
       "      <td>0.133333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>287</th>\n",
       "      <td>True</td>\n",
       "      <td>ratio_frames_5mins</td>\n",
       "      <td>ratio_bouts_5mins</td>\n",
       "      <td>0.008389</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3.csv</td>\n",
       "      <td>fraction_aggressive_encounters_5mins</td>\n",
       "      <td>0.117647</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>288 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     has_aggression annotation_time_frames annotation_time_bouts  \\\n",
       "0              True      ratio_frames_full      ratio_bouts_full   \n",
       "1              True      ratio_frames_full      ratio_bouts_full   \n",
       "2              True      ratio_frames_full      ratio_bouts_full   \n",
       "3              True      ratio_frames_full      ratio_bouts_full   \n",
       "4              True      ratio_frames_full      ratio_bouts_full   \n",
       "..              ...                    ...                   ...   \n",
       "283            True     ratio_frames_5mins     ratio_bouts_5mins   \n",
       "284           False     ratio_frames_5mins     ratio_bouts_5mins   \n",
       "285            True     ratio_frames_5mins     ratio_bouts_5mins   \n",
       "286            True     ratio_frames_5mins     ratio_bouts_5mins   \n",
       "287            True     ratio_frames_5mins     ratio_bouts_5mins   \n",
       "\n",
       "     ratio_frames  ratio_bouts      condition  \\\n",
       "0        0.004277     0.085545  virgin_virgin   \n",
       "1        0.011225     0.654950  virgin_virgin   \n",
       "2        0.027889     0.601190  virgin_virgin   \n",
       "3        0.009081     0.571867  virgin_virgin   \n",
       "4        0.018440     0.908403  virgin_virgin   \n",
       "..            ...          ...            ...   \n",
       "283      0.000000     0.000000  virgin_virgin   \n",
       "284      0.000000     0.000000  virgin_virgin   \n",
       "285      0.000000     0.000000  virgin_virgin   \n",
       "286      0.009500     0.400000  virgin_virgin   \n",
       "287      0.008389     0.600000  virgin_virgin   \n",
       "\n",
       "                               experiment  \\\n",
       "0    video_2017-09-05T13_28_41_arena4.csv   \n",
       "1    video_2017-09-05T14_34_55_arena2.csv   \n",
       "2    video_2017-09-05T15_42_04_arena3.csv   \n",
       "3    video_2017-09-06T13_42_13_arena1.csv   \n",
       "4    video_2017-09-06T14_45_32_arena3.csv   \n",
       "..                                    ...   \n",
       "283  video_2017-11-02T16_11_06_arena3.csv   \n",
       "284  video_2017-11-03T14_54_45_arena1.csv   \n",
       "285  video_2017-11-03T16_20_50_arena4.csv   \n",
       "286  video_2017-12-20T12_58_51_arena4.csv   \n",
       "287  video_2017-12-20T14_01_01_arena3.csv   \n",
       "\n",
       "               annotation_time_encounters  fraction_aggressive_encounters  \n",
       "0     fraction_aggressive_encounters_full                        0.033333  \n",
       "1     fraction_aggressive_encounters_full                        0.384615  \n",
       "2     fraction_aggressive_encounters_full                        0.533333  \n",
       "3     fraction_aggressive_encounters_full                        0.193548  \n",
       "4     fraction_aggressive_encounters_full                        0.400000  \n",
       "..                                    ...                             ...  \n",
       "283  fraction_aggressive_encounters_5mins                        0.000000  \n",
       "284  fraction_aggressive_encounters_5mins                        0.000000  \n",
       "285  fraction_aggressive_encounters_5mins                        0.000000  \n",
       "286  fraction_aggressive_encounters_5mins                        0.133333  \n",
       "287  fraction_aggressive_encounters_5mins                        0.117647  \n",
       "\n",
       "[288 rows x 9 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.melt(aggression_df,\n",
    "                        id_vars=['has_aggression', 'ratio_bouts_full', 'ratio_bouts_5mins', 'fraction_aggressive_encounters_full', 'fraction_aggressive_encounters_5mins', 'condition', 'experiment'],\n",
    "                        value_vars=['ratio_frames_full', 'ratio_frames_5mins'],\n",
    "                        var_name='annotation_time_frames',\n",
    "                        value_name='ratio_frames'\n",
    "                       )\n",
    "\n",
    "aggression_df = pd.melt(aggression_df,\n",
    "                        id_vars=['has_aggression', 'annotation_time_frames', 'ratio_frames', 'fraction_aggressive_encounters_full', 'fraction_aggressive_encounters_5mins', 'condition', 'experiment'],\n",
    "                        value_vars=['ratio_bouts_full', 'ratio_bouts_5mins'],\n",
    "                        var_name='annotation_time_bouts',\n",
    "                        value_name='ratio_bouts'\n",
    "                       )\n",
    "\n",
    "aggression_df = pd.melt(aggression_df,\n",
    "                        id_vars=['has_aggression', 'annotation_time_frames', 'annotation_time_bouts', 'ratio_frames', 'ratio_bouts', 'condition', 'experiment'],\n",
    "                        value_vars=['fraction_aggressive_encounters_full', 'fraction_aggressive_encounters_5mins'],\n",
    "                        var_name='annotation_time_encounters',\n",
    "                        value_name='fraction_aggressive_encounters'\n",
    "                       )\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>annotation_time</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>fraction_aggressive_encounters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>full</td>\n",
       "      <td>0.004277</td>\n",
       "      <td>0.085545</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "      <td>0.033333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>full</td>\n",
       "      <td>0.011225</td>\n",
       "      <td>0.654950</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "      <td>0.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>full</td>\n",
       "      <td>0.027889</td>\n",
       "      <td>0.601190</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "      <td>0.533333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>full</td>\n",
       "      <td>0.009081</td>\n",
       "      <td>0.571867</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "      <td>0.193548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>full</td>\n",
       "      <td>0.018440</td>\n",
       "      <td>0.908403</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "      <td>0.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>283</th>\n",
       "      <td>True</td>\n",
       "      <td>5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-02T16_11_06_arena3.csv</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>284</th>\n",
       "      <td>False</td>\n",
       "      <td>5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T14_54_45_arena1.csv</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>285</th>\n",
       "      <td>True</td>\n",
       "      <td>5mins</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-11-03T16_20_50_arena4.csv</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>286</th>\n",
       "      <td>True</td>\n",
       "      <td>5mins</td>\n",
       "      <td>0.009500</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T12_58_51_arena4.csv</td>\n",
       "      <td>0.133333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>287</th>\n",
       "      <td>True</td>\n",
       "      <td>5mins</td>\n",
       "      <td>0.008389</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-12-20T14_01_01_arena3.csv</td>\n",
       "      <td>0.117647</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>72 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     has_aggression annotation_time  ratio_frames  ratio_bouts      condition  \\\n",
       "0              True            full      0.004277     0.085545  virgin_virgin   \n",
       "1              True            full      0.011225     0.654950  virgin_virgin   \n",
       "2              True            full      0.027889     0.601190  virgin_virgin   \n",
       "3              True            full      0.009081     0.571867  virgin_virgin   \n",
       "4              True            full      0.018440     0.908403  virgin_virgin   \n",
       "..              ...             ...           ...          ...            ...   \n",
       "283            True           5mins      0.000000     0.000000  virgin_virgin   \n",
       "284           False           5mins      0.000000     0.000000  virgin_virgin   \n",
       "285            True           5mins      0.000000     0.000000  virgin_virgin   \n",
       "286            True           5mins      0.009500     0.400000  virgin_virgin   \n",
       "287            True           5mins      0.008389     0.600000  virgin_virgin   \n",
       "\n",
       "                               experiment  fraction_aggressive_encounters  \n",
       "0    video_2017-09-05T13_28_41_arena4.csv                        0.033333  \n",
       "1    video_2017-09-05T14_34_55_arena2.csv                        0.384615  \n",
       "2    video_2017-09-05T15_42_04_arena3.csv                        0.533333  \n",
       "3    video_2017-09-06T13_42_13_arena1.csv                        0.193548  \n",
       "4    video_2017-09-06T14_45_32_arena3.csv                        0.400000  \n",
       "..                                    ...                             ...  \n",
       "283  video_2017-11-02T16_11_06_arena3.csv                        0.000000  \n",
       "284  video_2017-11-03T14_54_45_arena1.csv                        0.000000  \n",
       "285  video_2017-11-03T16_20_50_arena4.csv                        0.000000  \n",
       "286  video_2017-12-20T12_58_51_arena4.csv                        0.133333  \n",
       "287  video_2017-12-20T14_01_01_arena3.csv                        0.117647  \n",
       "\n",
       "[72 rows x 7 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Keep only the last part of the annotation time identifier, (i.e., \"full\" or \"5mins\"), since\n",
    "# that is the oart that actually carries information.\n",
    "aggression_df['annotation_time_frames'] = aggression_df['annotation_time_frames'].apply(lambda x: x.split('_')[-1])\n",
    "aggression_df['annotation_time_bouts'] = aggression_df['annotation_time_bouts'].apply(lambda x: x.split('_')[-1])\n",
    "aggression_df['annotation_time_encounters'] = aggression_df['annotation_time_encounters'].apply(lambda x: x.split('_')[-1])\n",
    "\n",
    "# Remove redundant rows, keeping only those where all three metrics meet the same annotation\n",
    "# metric i.e., either all \"full\" or all \"5mins\".\n",
    "aggression_df = aggression_df.query('annotation_time_frames==annotation_time_bouts').copy()\n",
    "aggression_df = aggression_df.query('annotation_time_bouts==annotation_time_encounters').copy()\n",
    "\n",
    "# Drop redundant columns.\n",
    "aggression_df = aggression_df.copy().drop(columns=['annotation_time_bouts', 'annotation_time_encounters'])\n",
    "\n",
    "# Rename the leftover column.\n",
    "aggression_df.rename(columns={'annotation_time_frames': 'annotation_time'}, inplace=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>annotation_time</th>\n",
       "      <th>ratio_frames</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.004277</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.011225</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.027889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.009081</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.018440</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       condition                            experiment annotation_time  \\\n",
       "0  virgin_virgin  video_2017-09-05T13_28_41_arena4.csv            full   \n",
       "1  virgin_virgin  video_2017-09-05T14_34_55_arena2.csv            full   \n",
       "2  virgin_virgin  video_2017-09-05T15_42_04_arena3.csv            full   \n",
       "3  virgin_virgin  video_2017-09-06T13_42_13_arena1.csv            full   \n",
       "4  virgin_virgin  video_2017-09-06T14_45_32_arena3.csv            full   \n",
       "\n",
       "   ratio_frames  \n",
       "0      0.004277  \n",
       "1      0.011225  \n",
       "2      0.027889  \n",
       "3      0.009081  \n",
       "4      0.018440  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_df = aggression_df.copy()[['condition', 'experiment', 'annotation_time', 'ratio_frames']]\n",
    "ratio_frames_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t 5mins \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.199858\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.10676842348759608 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': 0.10676842348759608}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_pvalues = {}\n",
    "\n",
    "control = ratio_frames_df.query('annotation_time==\"full\"')['ratio_frames']\n",
    "\n",
    "for time in ratio_frames_df['annotation_time'].unique()[1:]:\n",
    "\n",
    "    print('\\n\\t', time, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_frames_df.query('annotation_time==\"' + time + '\"')['ratio_frames']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_frames_pvalues[time] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_frames_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5mins\n",
      "Large Efect: -1.0 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': -1.0}"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_effect_sizes = {}\n",
    "\n",
    "control = ratio_frames_df.query('annotation_time==\"full\"')['ratio_frames']\n",
    "\n",
    "for time in ratio_frames_df['annotation_time'].unique()[1:]:\n",
    "    \n",
    "    print(time)\n",
    "    \n",
    "    test = ratio_frames_df.query('annotation_time==\"' + time +'\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_frames_effect_sizes[time] = median_diff\n",
    "    \n",
    "ratio_frames_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALgAAAEgCAYAAAAHcbldAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO2dd3gU1duG781ueiGFhARCQoc0ktASQgtBqnQiRVFAkaJBsGBBqSpiL6D4UaSIgog0Aem919BrIKRX0utm93x/5OdKJGWD2ewmzH1de13ZmZ2ZZ2afnH3nzHveIxNCCCQ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tm3bNN9TadcsJCSEVatWoVKpyM3N5Zdffin3nLShRueiyGQytm7dyuuvv463tzfGxsbUrVuXHTt24O/vT3R0NO3ataOoqIhevXoxZcoUYmJisLe3Z/bs2dy5c4fWrVtr8hgWLFhA//79cXZ2pnPnzo/8DE+bNo3JkyfzySefUKdOHYKCgrh37x5du3bFzc2N7t27s2LFCs3nv/vuOyZMmMCKFSuQyWQsW7YMFxeXKjn3/v37Ex4e/sj5lcfHH3/MvHnzCAwMxNjYGLlczoIFCzQDPZYsWcKQIUMoLCzE3d1d888JxaNsli9fjqWlJatWrQKK02nHjBnDTz/9pEkxfpgRI0YwdOhQfHx8gOJf3L8HOzycC/M3EydO5NatW/j6+qJUKnnuuecYMmQIBw8efOzr9MTlokRGRhIcHFzpxKAnmUaNGnHw4MFy870NlRodokhIVMQT14JLPFlILbhErUYyuEStRjK4RK1GMrhErUYyuEStRjK4RK1GMrhErUYyuESt5v8BbFzGDMEUvO0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_frames_df['annotation_time'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='annotation_time',\n",
    "            y='ratio_frames',\n",
    "            data=ratio_frames_df,\n",
    "            order=['full', '5mins'],\n",
    "            palette=['steelblue'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='annotation_time',\n",
    "              y='ratio_frames',\n",
    "              data=ratio_frames_df,\n",
    "              order=['full', '5mins'],\n",
    "              palette=['steelblue'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Format boxplot grouping hatching.\n",
    "for b, boxplot in enumerate(axis.artists):\n",
    "    if b % 2 != 0:\n",
    "        boxplot.set_hatch('///')\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels('')\n",
    "axis.set_ylabel('Aggression Rate (%)')\n",
    "axis.set_ylim(0, 0.05)\n",
    "axis.set_yticks(np.arange(0, 0.05+0.01, 0.01))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_frames_df.query('annotation_time==\"'+time+'\"')['experiment'].nunique()) for time in ratio_frames_df['annotation_time'].unique()]\n",
    "row2 = ['Whole\\nCopulation', 'First 5 Minutes\\nof Copulation']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='right',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.    \n",
    "for p, condition in enumerate(ratio_frames_df['annotation_time'].unique()[1:]):\n",
    "    sig_height = 6 if (ratio_frames_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_frames_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_frames_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.048,\n",
    "                                 ticksize=0.001,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_rate_whole_cop_5mins_comparison_4arenas'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Bouts / Min."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>annotation_time</th>\n",
       "      <th>ratio_bouts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.085545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.654950</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.601190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.571867</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.908403</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       condition                            experiment annotation_time  \\\n",
       "0  virgin_virgin  video_2017-09-05T13_28_41_arena4.csv            full   \n",
       "1  virgin_virgin  video_2017-09-05T14_34_55_arena2.csv            full   \n",
       "2  virgin_virgin  video_2017-09-05T15_42_04_arena3.csv            full   \n",
       "3  virgin_virgin  video_2017-09-06T13_42_13_arena1.csv            full   \n",
       "4  virgin_virgin  video_2017-09-06T14_45_32_arena3.csv            full   \n",
       "\n",
       "   ratio_bouts  \n",
       "0     0.085545  \n",
       "1     0.654950  \n",
       "2     0.601190  \n",
       "3     0.571867  \n",
       "4     0.908403  "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_df = aggression_df.copy()[['condition', 'experiment', 'annotation_time', 'ratio_bouts']]\n",
    "ratio_bouts_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t 5mins \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.082417\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.21734871809381073 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': 0.21734871809381073}"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_pvalues = {}\n",
    "\n",
    "control = ratio_bouts_df.query('annotation_time==\"full\"')['ratio_bouts']\n",
    "\n",
    "for time in ratio_bouts_df['annotation_time'].unique()[1:]:\n",
    "\n",
    "    print('\\n\\t', time, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_bouts_df.query('annotation_time==\"' + time + '\"')['ratio_bouts']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_bouts_pvalues[time] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_bouts_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5mins\n",
      "Large Efect: -1.0 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': -1.0}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_bouts_effect_sizes = {}\n",
    "\n",
    "control = ratio_bouts_df.query('annotation_time==\"full\"')['ratio_bouts']\n",
    "\n",
    "for time in ratio_bouts_df['annotation_time'].unique()[1:]:\n",
    "    \n",
    "    print(time)\n",
    "    \n",
    "    test = ratio_bouts_df.query('annotation_time==\"' + time +'\"')['ratio_bouts']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_bouts_effect_sizes[time] = median_diff\n",
    "    \n",
    "ratio_bouts_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAALgAAAEgCAYAAAAHcbldAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO2dd3gU1frHP5veGyEkISShBUI6EAjVAAKC9I6AYAH0KiqKDa8EUUSvoojAVUQQpF/pTXqTnkDoJYH03nvZ7J7fH/mxEiFhgd3sJsznefZ5Mmd2Zr4z883Zd8685xyZEEIgIVFPMdC1AAkJbSIZXKJeIxlcol4jGVyiXiMZXKJeIxlcol5TKwZftGgRPj4++Pr6MnjwYNLT02vjsBISyLTdDh4REcHw4cO5ePEitra2zJgxg4KCAn7++WdtHlZCAqiFGrxdu3ZERUVha2tLaWkpSUlJNGjQQNuHlZAAailEMTY2ZuvWrbi5uXHs2DFeeuml2jishETtPWQOGTKEzMxMZs+eTd++fVEqlfd9Z/bs2chkMtVHQuJJ0XoMHh0dTWpqKl27dgVAoVBgYmJCenp6jaGKTCZDSpOReFK0XoOnpKQwZswYMjMzAVizZg2+vr5SHC5RKxhp+wDdunXjk08+ITQ0FCMjI1xdXdm6dau2DyshAdRCiPK4SCGKhCaQ3mTqKbGxsdjZ2fH111/j7OyMk5MT06dPB2Dt2rW0bNkSe3t7goOD2bdvn47V6jFCT9FjabVCTEyMAMTUqVNFaWmpOHXqlDAxMRF//fWXMDExEeHh4UIIIZYvXy7c3d2FUqnUsWL9RKrB9ZwPP/wQU1NTQkJCaN26NdHR0VhYWLB06VJOnTrFhAkTiI2NlZpVq0EyuJ7TsGFD1d/GxsYIITh48CAZGRk899xzODs78/XXX+tQoX6j9VYUCc2Sn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WlqycuVKoDKdduLEiSxfvlyVYnwvo0ePZtiwYfj5+QGVv7h3Ozvcmwtzl6lTp3Lr1i0CAgKQy+WMGzeOoUOHcuTIkce+Tk9dLkpsbCyhoaGPnBj0NOPp6cmRI0dqzPfWV+p0iCIh8TCeuhpc4ulCqsEl6jWSwSXqNZLBJeo1ksEl6jWSwSXqNZLBJeo1ksEl6jWSwSXqNf8H4Q0+k3sM1mQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_bouts_df['annotation_time'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='annotation_time',\n",
    "            y='ratio_bouts',\n",
    "            data=ratio_bouts_df,\n",
    "            order=['full', '5mins'],\n",
    "            palette=['steelblue'],\n",
    "            showfliers=False,\n",
    "            width=0.6,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='annotation_time',\n",
    "              y='ratio_bouts',\n",
    "              data=ratio_bouts_df,\n",
    "              order=['full', '5mins'],\n",
    "              palette=['steelblue'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Format boxplot grouping hatching.\n",
    "for b, boxplot in enumerate(axis.artists):\n",
    "    if b % 2 != 0:\n",
    "        boxplot.set_hatch('///')\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels('')\n",
    "axis.set_ylabel('# Bouts / Minute of Copulation')\n",
    "axis.set_ylim(0, 3)\n",
    "axis.set_yticks(np.arange(0, 3+1, 1))\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_bouts_df.query('annotation_time==\"'+time+'\"')['experiment'].nunique()) for time in ratio_bouts_df['annotation_time'].unique()]\n",
    "row2 = ['Whole\\nCopulation', 'First 5 Minutes\\nof Copulation']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='right',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.    \n",
    "for p, condition in enumerate(ratio_bouts_df['annotation_time'].unique()[1:]):\n",
    "    sig_height = 6 if (ratio_bouts_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_bouts_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_bouts_pvalues.get(condition, 'NaN'),\n",
    "                                 y=2.8,\n",
    "                                 ticksize=0.1,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'nbouts_aggression_normalized_whole_cop_5mins_comparison_4arenas'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggressive Encounters"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "      <th>annotation_time</th>\n",
       "      <th>fraction_aggressive_encounters</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T13_28_41_arena4.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.033333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T14_34_55_arena2.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-05T15_42_04_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.533333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T13_42_13_arena1.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.193548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>virgin_virgin</td>\n",
       "      <td>video_2017-09-06T14_45_32_arena3.csv</td>\n",
       "      <td>full</td>\n",
       "      <td>0.400000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       condition                            experiment annotation_time  \\\n",
       "0  virgin_virgin  video_2017-09-05T13_28_41_arena4.csv            full   \n",
       "1  virgin_virgin  video_2017-09-05T14_34_55_arena2.csv            full   \n",
       "2  virgin_virgin  video_2017-09-05T15_42_04_arena3.csv            full   \n",
       "3  virgin_virgin  video_2017-09-06T13_42_13_arena1.csv            full   \n",
       "4  virgin_virgin  video_2017-09-06T14_45_32_arena3.csv            full   \n",
       "\n",
       "   fraction_aggressive_encounters  \n",
       "0                        0.033333  \n",
       "1                        0.384615  \n",
       "2                        0.533333  \n",
       "3                        0.193548  \n",
       "4                        0.400000  "
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_aggressive_encounters_df = aggression_df.copy()[['condition', 'experiment', 'annotation_time', 'fraction_aggressive_encounters']]\n",
    "ratio_aggressive_encounters_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t 5mins \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.509242\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.07500144518028802 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': 0.07500144518028802}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_aggressive_encounters_pvalues = {}\n",
    "\n",
    "control = ratio_aggressive_encounters_df.query('annotation_time==\"full\"')['fraction_aggressive_encounters']\n",
    "\n",
    "for time in ratio_aggressive_encounters_df['annotation_time'].unique()[1:]:\n",
    "\n",
    "    print('\\n\\t', time, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_aggressive_encounters_df.query('annotation_time==\"' + time + '\"')['fraction_aggressive_encounters']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_aggressive_encounters_pvalues[time] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_aggressive_encounters_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5mins\n",
      "Large Efect: -1.0 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'5mins': -1.0}"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_aggressive_encounters_effect_sizes = {}\n",
    "\n",
    "control = ratio_aggressive_encounters_df.query('annotation_time==\"full\"')['fraction_aggressive_encounters']\n",
    "\n",
    "for time in ratio_bouts_df['annotation_time'].unique()[1:]:\n",
    "    \n",
    "    print(time)\n",
    "    \n",
    "    test = ratio_aggressive_encounters_df.query('annotation_time==\"' + time +'\"')['fraction_aggressive_encounters']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_aggressive_encounters_effect_sizes[time] = median_diff\n",
    "    \n",
    "ratio_aggressive_encounters_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMYAAAEzCAYAAABqs3xDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACx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DhAmzZtqmz7u3Tp8sBt1MTc3JyJEycyfvx4srOzgTsPP02fPh1/f39at27N4cOH1VfgFi5cWGZ5d69erVu3Dn9/f+zs7Mo067j3QbC7/vrrL0JDQxk3bhwNGjRg06ZN6v+Vpv3WpUsXfvrpJ5RKJfn5+axYsaLcbdLGE9ckRKFQsHHjRqZOnUpgYCDGxsY4OjqyZcsWmjZtSnx8PC1atKC0tJTu3bszadIkbt68ib29PREREVy7do0mTZqomxPMnj2bXr164eLiQvv27e+rKkyZMoXx48fz8ccfU6tWLdq2bUtsbCwdO3bE09OTzp07s2TJEvXnv/nmG8aMGcOSJUtQKBT88MMPuLq6Vtn29+rVi6ioqPu2sTwffvghs2bNIiQkBGPj/2/fjk0gBKIgDA/IRRaxNiC2YAtrYmBgaCvWICjYydZhZB1rcoEoBo/Du+jA/ythYZgN5r2UJIn6vj9vUYZhkPdeMUY5585gS/sB0TiOStNU8zxL2he4bdtqmqZzlXxV17WqqlKe55L2lj/uMa6zlEPXdVqWRUVRaNs2NU0j771CCD+/E5OQG9Z1VVmWX+96ni7LMoUQPk7L/9XjvlLAHTQGYKAxAAPBAAwEAzAQDMBAMAADwQAMBAMwEAzA8AYL8dxxNaH+CgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_aggressive_encounters_df['annotation_time'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='annotation_time',\n",
    "            y='fraction_aggressive_encounters',\n",
    "            data=ratio_aggressive_encounters_df,\n",
    "            order=['full', '5mins'],\n",
    "            palette=['steelblue'],\n",
    "            showfliers=False,\n",
    "            width=0.6,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='annotation_time',\n",
    "              y='fraction_aggressive_encounters',\n",
    "              data=ratio_aggressive_encounters_df,\n",
    "              order=['full', '5mins'],\n",
    "              palette=['steelblue'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Format boxplot grouping hatching.\n",
    "for b, boxplot in enumerate(axis.artists):\n",
    "    if b % 2 != 0:\n",
    "        boxplot.set_hatch('///')\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels('')\n",
    "axis.set_ylabel('Aggressive Encounters (%)')\n",
    "axis.set_ylim(0, 1+0.02)\n",
    "axis.set_yticks(np.arange(0, 1+0.02, 0.2))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_aggressive_encounters_df.query('annotation_time==\"'+time+'\"')['experiment'].nunique()) for time in ratio_aggressive_encounters_df['annotation_time'].unique()]\n",
    "row2 = ['Whole\\nCopulation', 'First 5 Minutes\\nof Copulation']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='right',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical results.    \n",
    "for p, condition in enumerate(ratio_aggressive_encounters_df['annotation_time'].unique()[1:]):\n",
    "    sig_height = 6 if (ratio_aggressive_encounters_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_aggressive_encounters_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_aggressive_encounters_pvalues.get(condition, 'NaN'),\n",
    "                                 y=1.075,\n",
    "                                 ticksize=0.025,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'fraction_aggressive_encounters_whole_cop_5mins_comparison_4arenas'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
